package com.mobiletrack.service;

import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.os.Vibrator;

public class BlockIncomingCallService {

	 public static void turnOffRinger(Context context){
		 	AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
			audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
//			PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
//			PowerManager.WakeLock wl = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Your Tag");
//			wl.acquire();
//			wl.release();
//			Settings.System.putInt(context.getContentResolver(), 
//					Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
			Vibrator bz = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
			bz.cancel();			
	 }
	 
	 public static void goBackToHomeScreen(Context context){
		 Intent showOptions = new Intent(Intent.ACTION_MAIN);
		 showOptions.addCategory(Intent.CATEGORY_HOME);
		 context.startActivity(showOptions);
	 }
	 
	 public static void turnOnRinger(Context context){
		 AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
		 audioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
		 Vibrator bz = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
		 bz.vibrate(10);
	 } 
}



